import cv2
import numpy as np
img = cv2.imread(r"/\images\005.jpeg", cv2.IMREAD_GRAYSCALE)

height = img.shape[0]
width = img.shape[1]
dsize = (width, height)

# 拉普拉斯边缘检测
img1 = cv2.Laplacian(img, cv2.CV_8U)

# sobel边缘检测
img2 = cv2.Sobel(img, cv2.CV_8U, 0, 1)

# canny边缘检测
img3 = cv2.Canny(img, 200, 300)

pic = [("img", img), ("img1", img1), ("img2", img2),
       ("img3", img3)]
for name, val in pic:
    cv2.imshow(name, val)
    key = cv2.waitKey(5000)
    if key == 27:
        break
cv2.destroyAllWindows()
